home *** CD-ROM | disk | FTP | other *** search
- /* -------------------------------------------------------
- LISTING 2
- File: testbrk.c
-
- This is the test driver for the routines in
- breakout.asm.
-
- Author: David Burki
- ------------------------------------------------------- */
- #include <stdio.h>
-
-
- // define far a pointer to a void function
- typedef void (far *PFV)();
-
- // function prototypes
- void insure(PFV);
- void interrupt far pre_termination(void);
- void cancel(void);
-
-
- /* -------------------------------------------------------
- function which performs any necessary clean-up before
- terminating the application
- ------------------------------------------------------- */
- void interrupt far pre_termination()
- {
- printf("\nIn the pre-termination function\npress any key\n");
- getch();
- exit(1);
- }
-
- // test driver main function
- main()
- {
- // register the cancel function so exit will call it
- atexit(cancel);
-
- // install the breakout tool
- insure((PFV)pre_termination);
-
- // a never ending loop
- for(;;)
- ;
- }
-